﻿using ExamDemo.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace ExamDemo.Data
{
    public class ExamDemoDbinity: DropCreateDatabaseAlways<ExamDemoDb>
    {
            protected override void Seed(ExamDemoDb db)
            {
                db.Users.Add(new Models.Users
                {
                    Username = "111",
                    Password = "111",
                    CreatedAt = DateTime.Now,
                    UpdatedAt = DateTime.Now,
                    Version = 1,
                });

                db.Users.Add(new Models.Users
                {
                    Username = "222",
                    Password = "222",
                    CreatedAt = DateTime.Now,
                    UpdatedAt = DateTime.Now,
                    Version = 1,
                });

                db.Messages.AddRange(new List<Messages>
            {
                new Messages
                {
                    FromUserId=1,
                    Content="说说1",
                    CreatedAt=DateTime.Now,
                    UpdatedAt=DateTime.Now,
                    Version=1,
                }
            });

                db.Messages.AddRange(new List<Messages>
            {
                new Messages
                {
                    FromUserId=2,
                    Content="说说2",
                    CreatedAt=DateTime.Now,
                    UpdatedAt=DateTime.Now,
                    Version=1,
                }
            });

                db.Comments.AddRange(new List<Comments>
            {
                new Comments
                {
                    MsgId=1,
                    FromUserId=1,
                    Content="评论1",
                    CreatedAt=DateTime.Now,
                    UpdatedAt=DateTime.Now,
                    Version=1,
                }
            });

                db.Comments.AddRange(new List<Comments>
            {
                new Comments
                {
                    MsgId=2,
                    FromUserId=2,
                    Content="评论2",
                    CreatedAt=DateTime.Now,
                    UpdatedAt=DateTime.Now,
                    Version=1,
                }
            });
            }
    }
}
